<script setup lang="ts">
import Channel from './components/Channel.vue'
import NewsList from './components/NewsList.vue'
// !获取频道列表
import axios from 'axios'

const getList = async () => {
  // !get 的第一个泛型参数控制的就是 r.data 的类型
  const r = await axios.get<{ data: { channels: { id: number; name: string }[] }; message: string }>('http://geek.itheima.net/v1_0/channels')
  // r.data => 后端返回的数据
  // console.log(r.data.data.channels)
  console.log(r.data.data.channels[0].id)
}
getList()

</script>

<template>
  <Channel />
  <NewsList />
</template>